<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">

<section class="content-header">
    <h1>制作件清单维护</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label for="query-proCode">项目编号</label>
                                    <input id="query-proCode" type="text" name="proCode" class="form-control"
                                           placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label for="query-proName">项目名称</label>
                                    <input id="query-proName" type="text" name="proName" class="form-control"
                                           placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label for="query-malType">类型</label>
                                    <select id="query-malType" class="form-control" name="specialId">
                                        <option value="" selected>请选择</option>
                                        <option th:each="type : ${specialId}" th:value="${type.id}"
                                                th:text="${type.name}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-part">部位</label>
                                    <input id="query-part" type="text" name="part" class="form-control"
                                           placeholder="请输入部分">
                                </div>
                                <div class="form-group">
                                    <label for="query-drawType">清单来源</label>
                                    <select id="query-drawType" class="form-control" name="drawType">
                                        <option value="" selected>全部</option>
                                        <option value="1">设计</option>
                                        <option value="2">生产</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-deptName">工艺科室</label>
                                    <select id="query-deptName" class="form-control" name="deptName">
                                        <option value="" selected>请选择</option>
                                        <option th:each="type : ${deptName}" th:value="${type.name}"
                                                th:text="${type.name}"></option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="query-startTime">下图日期</label>
                                    <input id="query-startTime" type="text" class="form-control datepicker"
                                           name="startTime"
                                           readonly="readonly"/>
                                    <label for="query-endTime"> 至 </label>
                                    <input id="query-endTime" type="text" class="form-control datepicker" name="endTime"
                                           readonly="readonly"/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search"
                                        onclick="js.table.search(table)">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>

                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    let table, typeName = ['', '外购件', '外协件', '原材料'];

    $(function () {

        /** 加载列表 */
        table = js.table.init({
            url: ctx + "craft/maintain/list",
            columns: [
                {

                    title: '序号', field: 'id', width: '50',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: "项目编号", field: 'proCode'},
                {title: "项目名称", field: 'proName'},
                {title: "项目数量", field: 'proNum'},
                {title: "类型", field: 'special'},
                {title: "部分", field: 'part'},
                {
                    title: "清单来源", field: 'drawType',
                    formatter: function (value) {
                        if (value == 1) {

                            return '<span>设计</span>';
                        } else {
                            return '<span>生产</span>';
                        }
                    }
                },
                {title: "总图号", field: 'generalDrawingNo'},
                {title: "设计科室", field: 'sectionName'},
                {title: "设计者", field: 'createNameTwo'},
                {title: "工艺科室", field: 'deptName'},
                {title: "下发日期", field: 'verifyTime'},
                {
                    title: "操作",
                    formatter: function (value, row) {
                        let actions = [];
                        actions.push('<a class="btn btn-info btn-xs many-view" target="_blank" href="' + ctx + 'craft/maintain/info/' + row.id + '"> 查看</a> ');
                        // actions.push('<a class="btn btn-primary btn-xs" target="_blank" href="' + ctx + 'report/query/print/' + row.id + '"> 打印</a> ');
                        return actions.join('');
                    }
                }
            ]
        });
    });

    $("#bootstrap-table").on('click', ".many-view", function () {
        $(this).css({'background-color' : 'green', 'font-weight' : 'bolder'});
    });
</script>
</body>
</html>
